@extends('Home.User.Common.layout')
@section('title')
    公司资料_设置
@endsection
@section('content')
    <!--  content  -->
    <main class="common_content">
        <div class="container">
            <div class="ct_main">
                @include('Home.User.Set.Common.set_menu')
                <ul class="nav-items1 nav-items2 w999" id="tab-content2">
                    <!--基本设置-->
                    <li class="basic-sets active">
                        <div class="selector-head">
                            <h2>基本设置</h2>
                        </div>
                        <!--公司资料-->
                        <ul class="basic-sets-ul">
                            <li>
                                <h2 class="basic-title">
                                    公司资料
                                    <div class="rt">
                                        <a href="javascript:;" onclick="subForm('{{route('config_set')}}',true)" title="保存"><i class="icon icon-save-green"></i></a>
                                        <a href="javascript:location.replace(location.href);" title="重置"><i class="icon icon-shuaxin"></i></a>
                                    </div>
                                </h2>
                                <form class="layui-form company-info" action="" id="form-user" lay-filter="form-user">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">公司名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="title" value="{{$obj['title']}}" lay-verify="title" autocomplete="off" placeholder="请输入公司名称" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">公司LOGO</label>
                                        <div class="layui-upload">
                                            <button type="button" class="layui-btn" id="logo_button">上传LOGO</button>
                                            <input type="hidden" name="logo" id="logo" value="{{$obj['logo']}}">
                                            <div class="layui-upload-list">
                                                <img class="layui-upload-img" id="logo_img" src="{{$obj['logo']}}">
                                            </div>
                                        </div>
                                    </div>
                                    @include('Home.User.Common._msg')
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </main>
@endsection
@section('footer')
    @include('Home.User.Common._form')
    <script>
        layui.use(['form', 'layer', 'upload'], function() {
            var upload = layui.upload;

            //图片上传
            upload.render({
                elem: '#logo_button',
                url: '{{route('file_upload')}}',
                auto: true, //选择文件后不自动上传
                accept: 'images', //图片文件
                size: 1024*4,
                done: function(res, index, upload){
                    if(res.code){
                        console.log($("#logo"),res);
                        $("#logo").val(res.path);
                        $("#logo_img").attr('src',res.path);
                    }else{
                        layer.msg(res.msg,{icon:2});
                    }
                },
                error: function(){

                }
            });
        });
    </script>
@endsection
